package cn.itzzx.lagou.demo.controller;

import cn.itzzx.lagou.framework.annotation.LagouController;
import cn.itzzx.lagou.framework.annotation.LagouRequestMapping;
import cn.itzzx.lagou.framework.annotation.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 基于 Class 控制权限
 * @author Martin
 * @since 1.0
 */
@LagouRequestMapping("/auth")
@Security(value = {"zhangsan"})
@LagouController
public class ClassController {


    /**
     * 拥有权限地址
     *  http://localhost:8080/auth/index?username=zhangsan
     *
     *
     * 无权限地址
     *  http://localhost:8080/auth/index?username=lisi
     * @param request
     * @param response
     * @param username
     * @throws IOException
     */
    @LagouRequestMapping("/index")
    public void index(HttpServletRequest request, HttpServletResponse response, String username) throws IOException {
        System.out.println("执行 执行ClassController#index 方法");
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write("执行ClassController#index");
    }


}
